import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Starter implements ActionListener
{
	public static void main(String[] args) throws Exception
	{
		new Starter();
	}

	JLabel uhrzeit = new JLabel(getCurrentTime());

	public Starter()
	{
		JFrame jframe = new JFrame();
		JPanel contentPanel = new JPanel(null);

		JButton updateTime = new JButton("Aktualisieren");

		contentPanel.add(uhrzeit);
		contentPanel.add(updateTime);

		uhrzeit.setBounds(23, 23, 200, 42);
		
		uhrzeit.setHorizontalAlignment(JLabel.CENTER);
		uhrzeit.setFont(new Font("Arial", Font.BOLD, 20));

		updateTime.setBounds(73, 88, 100, 42);
		updateTime.addActionListener(this);

		jframe.setVisible(true);
		jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jframe.setTitle("Korays Fenster");
		jframe.setContentPane(contentPanel);

		jframe.setBounds(200, 200, 246, 173);
	}

	@Override
	public void actionPerformed(ActionEvent e)
	{
		uhrzeit.setText(getCurrentTime());
	}

	private String getCurrentTime()
	{
		Date aktuelleZeit = new Date();
		
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
		return sdf.format(aktuelleZeit);
	}

}
